package club.kingyin.commons.mail;

import lombok.Data;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

@Data
public class MailMessage {

    private String[] usernames;
    private String context;
    private String subject;

    public void setContext(String context) {
        this.context = Base64.getEncoder().encodeToString(context.getBytes(StandardCharsets.UTF_8));
    }

    public String getContext() {
        return new String(Base64.getDecoder().decode(context),StandardCharsets.UTF_8);
    }

    public void setUsernames(String... username) {
        this.usernames = username;
    }
}
